package cn.wh.beans.factory.support;

import cn.wh.beans.factory.config.BeanDefinition;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: wh
 * @create: 2022-08-19 16:57
 * @description
 **/
public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFactory implements BeanDefinitionRegistry {


    private Map<String, BeanDefinition> map = new HashMap<>();


    /**
     * 注册bean 到bean 容器
     *
     * @param beanName
     * @param beanDefinition
     */
    @Override
    public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) {
        map.put(beanName, beanDefinition);
    }

    /**
     * 获取bean
     *
     * @param beanName
     * @return
     */
    @Override
    protected BeanDefinition getBeanDefintion(String beanName) {
        return map.get(beanName);
    }
}
